package cn.swust.designpatternlearningplatform.adapter;

import cn.swust.designpatternlearningplatform.domain.bo.TokenInfoBo;
import cn.swust.designpatternlearningplatform.domain.entity.Student;
import cn.swust.designpatternlearningplatform.domain.entity.Teacher;



/**
 * description:  将teacher或student对象转换成TokenInfoBo对象
 *
 * @author fly
 * @since 2023/3/28 11:26
 */
public class TokenInfoBoAdapter {

    public static TokenInfoBo toTokenInfo(Teacher teacher){
        TokenInfoBo bo = new TokenInfoBo();
        bo.setName(teacher.getTeacherName());
        bo.setRole("teacher");
        bo.setNumber(teacher.getTeacherAccount());
        return bo;
    }

    public static TokenInfoBo toTokenInfo(Student student){
        TokenInfoBo bo = new TokenInfoBo();
        bo.setName(student.getStudentName());
        bo.setRole("student");
        bo.setNumber(student.getStudentNumber());
        return bo;
    }


}
